Skip to content

runapptests.js: Workaround for incomplete emulator reset#4252

Merged
gfwilliams merged 2 commits into
espruino:masterfrom
halemmerich:fixTests
Jun 22, 2026
Merged

runapptests.js: Workaround for incomplete emulator reset#4252
gfwilliams merged 2 commits into
espruino:masterfrom
halemmerich:fixTests

Conversation

@halemmerich

@halemmerich halemmerich commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

This works around the incomplete reset in emu.factoryReset() by a full re-init for every test run.

I have poked around in the emulator itself, but could not get it working correctly. This is a bit slower than it was, but at least the Uncaught SyntaxError: Got [ERASED] expected EOF errors seem to be gone for now. I think it is somehow related to the internal state of Storage that does not get fully reset on factory reset.

The tests do not run in this repo because no apps changed, but you can have a look at the actions output here: https://github.com/halemmerich/BangleApps/actions/runs/27714695139/job/81984461701

@bobrippling

Copy link
Copy Markdown
Collaborator

I'm afraid I don't know enough about the emulator - probably one for @gfwilliams

@halemmerich

halemmerich commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator Author

This is essentially a workaround like #4160 . It is a bit less complex by just doing a complete new initialization of the whole emulator instead of adding logic for waiting for finished commands. I think that should be fixed in the emulators reset methods to prevent internal state surviving.
For now I have removed the testindex stuff from this PR to make this easy to revert when the emulator has been fixed. At least it gets the CI tests working again.

@halemmerich halemmerich changed the title Fix tests runapptests.js: Workaround for incomplete emulator reset Jun 20, 2026
@gfwilliams

Copy link
Copy Markdown
Member

Yes - I guess ideally we'd fix factoryReset. I think the issue is that while sending "reset()" the emulator is still running the old code while characters are sent and interpreted, right until the point the command is run. I think ideally we'd export the jswrap_interface_reset function from the emulator, but until then if this solution works then great - after all it's just for tests so it's not goingto effect the end user

@gfwilliams gfwilliams merged commit c041050 into espruino:master Jun 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants